<template>
  <div id="app">
    <div id="main" style="height:400px"></div>
  </div>
</template>

<script>
// import * as echarts from "echarts";
import purple from "./purple-passion.json"

export default {
  data() {
    return {};
  },
  mounted() {
    // 基于准备好的dom，初始化echarts实例
                  this.$echarts.registerTheme('purple', purple);
    var myChart = this.$echarts.init(document.getElementById("main"),purple, { renderer: 'svg' }
    // {
    //   height:400
    // }
    );
    // 绘制图表
    var option = {
      xAxis: {
        data: ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"],
      },
      yAxis: {},
      series: [
        {
          name: "销量",
          type: "bar",
          data: [5, 20, 36, 10, 10, 20],
        },
      ],
    };
    myChart.setOption(option)
          window.onresize = function () {
        myChart.resize();}

        console.log(purple);
  },
};
</script>


<style lang="scss">
*{
  padding: 0;
  margin: 0;
}
</style>
